function getCountryNames() {
  // set the query using the parameters
var FT_Query_CountryName = "SELECT 'name_0', count() FROM "+FT_TableID+" GROUP by 'name_0' ORDER by 'name_0'";
document.getElementById("FTquery4").innerHTML = FT_Query_CountryName; 
  var queryText = encodeURIComponent(FT_Query_CountryName);
  var query = new google.visualization.Query('http://www.google.com/fusiontables/gvizdata?tq='  + queryText);
  
  //set the callback function
  query.send(createCountryDropdown);
}

function createCountryDropdown(response) {
if (!response) {
  alert('no response');
  return;
}
if (response.isError()) {
  alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());
  return;
} 
  //for more information on the response object, see the documentation
  //http://code.google.com/apis/visualization/documentation/reference.html#QueryResponse
  numRows = response.getDataTable().getNumberOfRows();
  numCols = response.getDataTable().getNumberOfColumns();

  var countryNames = {};
  for (var i = 0; i < numRows; i++) {
    var countryName = response.getDataTable().getValue(i,0);
    // countryName = countryName.substring(0,countryName.indexOf('('));
    countryNames[countryName] = countryName;
  }
  var countryNameDropdown = "<select name='country_select' onchange='handleSelected(this)'>"
  countryNameDropdown += '<option selected> - Select a country - <\/option>';
  for (countryName in countryNames) {
    countryNameDropdown += "<option value='"+countryName+"'>"+countryName+"</option>"
//    document.getElementById('country_list').innerHTML += countryName+"<br>";
  }
  countryNameDropdown += "</select>"
  document.getElementById('dropdown_menu').innerHTML = countryNameDropdown;
}

